<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.lixiaofei.cn","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":true,"storage":true,"lazyload":true,"nav":{"valine":{"order":-1}}},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="Markdown简单明了，使用方便，特别是在自媒体时代，成为了更多写作者必备技能。 最近不断有朋友询问如何使用 Markdown 写作，今天我就一些写作中常用的 Markdown 语法点，做个简要说明，最后还会介绍一个，Markdown 写微信公众号的文章的方法。">
<meta property="og:type" content="article">
<meta property="og:title" content="自媒体写作神器 —— Markdown">
<meta property="og:url" content="http://www.lixiaofei.cn/2021-09-05-markdown/index.html">
<meta property="og:site_name" content="管窥程序">
<meta property="og:description" content="Markdown简单明了，使用方便，特别是在自媒体时代，成为了更多写作者必备技能。 最近不断有朋友询问如何使用 Markdown 写作，今天我就一些写作中常用的 Markdown 语法点，做个简要说明，最后还会介绍一个，Markdown 写微信公众号的文章的方法。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/uploads/20/1580520_alisx.png?1517841484=30%25">
<meta property="og:image" content="https://gitee.com/uploads/20/1580520_alisx.png?1517841484">
<meta property="og:image" content="http://blog.lixiaofei.cn/images/2021/09/markdown/01.jpg">
<meta property="article:published_time" content="2021-09-05T10:37:43.000Z">
<meta property="article:modified_time" content="2021-09-06T06:27:02.303Z">
<meta property="article:author" content="太阳雪">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/uploads/20/1580520_alisx.png?1517841484=30%25">

<link rel="canonical" href="http://www.lixiaofei.cn/2021-09-05-markdown/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>自媒体写作神器 —— Markdown | 管窥程序</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">管窥程序</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Today is a gift</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/alisx" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.lixiaofei.cn/2021-09-05-markdown/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.png">
      <meta itemprop="name" content="太阳雪">
      <meta itemprop="description" content="总结 技术 思考 想法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="管窥程序">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          自媒体写作神器 —— Markdown
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-09-05 18:37:43" itemprop="dateCreated datePublished" datetime="2021-09-05T18:37:43+08:00">2021-09-05</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-09-06 14:27:02" itemprop="dateModified" datetime="2021-09-06T14:27:02+08:00">2021-09-06</time>
              </span>

          
            <span id="/2021-09-05-markdown/" class="post-meta-item leancloud_visitors" data-flag-title="自媒体写作神器 —— Markdown" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021-09-05-markdown/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021-09-05-markdown/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><a href="https://zh.wikipedia.org/wiki/Markdown" target="_blank" rel="noopener" title="Markdown">Markdown</a>简单明了，使用方便，特别是在自媒体时代，成为了更多写作者必备技能。</p>
<p>最近不断有朋友询问如何使用 Markdown 写作，今天我就一些写作中常用的 Markdown 语法点，做个简要说明，最后还会介绍一个，Markdown 写微信公众号的文章的方法。</p>
<a id="more"></a>
<h2 id="斜体和粗体">斜体和粗体</h2>
<p>斜体用 <code>*</code> ，粗体用 <code>**</code></p>
<p>这是 <code>*斜体*</code>：<em>斜体</em> 这是 <code>**粗体**</code> <strong>粗体</strong></p>
<h2 id="标题">标题</h2>
<p>一级标题用 <code>#</code> 或者在下一行用至少一个<code>=</code>，</p>
<p>二级标题用 <code>##</code> 或者在下一行用至少一个<code>-</code>，</p>
<p>三级标题用 <code>###</code>，依次类推，最高到六级标题，也就是用六个 <code>#</code>，</p>
<blockquote>
<p>注意<code>#</code>和后面文字之间需要有个空格</p>
</blockquote>
<p>例如</p>
<blockquote>
<h1>一级标题</h1>
<h1>这也是一级标题</h1>
<h2 id="二级标题">二级标题</h2>
<p>下面的也是二级标题</p>
<h2 id="这也是二级标题">这也是二级标题</h2>
<h3 id="三级标题">三级标题</h3>
<h4 id="这是四级标题">这是四级标题</h4>
<h5 id="这是五级标题">这是五级标题</h5>
<h6 id="这是六级标题">这是六级标题</h6>
<p>####### 有没有七级标题 看来是没有了</p>
</blockquote>
<h2 id="分隔线">分隔线</h2>
<p>在单独的一样用 <code>***</code> 或者 <code>---</code> 来表示</p>
<blockquote>
<p>注意：分隔线 <code>---</code> 可能和二级标题有冲突，所有需要上下各有个空行</p>
</blockquote>
<p>分隔线 <code>---</code>:</p>
<hr>
<p>分隔线 <code>***</code>:</p>
<hr>
<h2 id="删除线">删除线</h2>
<p>用 <code>~~</code> 来表示，需要在被删除文字的两端都加。</p>
<p>例如 <s>我被删除了</s></p>
<h2 id="超链接">超链接</h2>
<h3 id="链接">链接</h3>
<p>语法是<code>[链接文字](链接地址 &quot;链接标题&quot;)</code></p>
<p>例如 <a href="http://blog.lixiaofei.cn" target="_blank" rel="noopener" title="李晓飞的博客">这是我的博客</a></p>
<p>公众号不支持非微信内部的链接，给链接添加标题，有些 Markdown 解释器可以将链接解释为文后的 <code>参考资料</code>，所以建议给链接加上标题。</p>
<h3 id="简易链接">简易链接</h3>
<p>如果只是将网址(URL)显示出来，并且可以点击，有个简便的写法，就是将链接用 <code>&lt;&gt;</code> 括起来，例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="bullet">- </span>我的邮箱: <span class="xml"><span class="tag">&lt;<span class="name">mymail@oneexample.com</span>&gt;</span></span></span><br><span class="line"><span class="bullet">- </span>我的博客：<span class="xml"><span class="tag">&lt;<span class="name">http:</span>//<span class="attr">blog.lixiaofei.com</span>&gt;</span></span></span><br></pre></td></tr></table></figure>
<p>显示为：</p>
<ul>
<li>我的邮箱: <a href="mailto:mymail@oneexample.com">mymail@oneexample.com</a></li>
<li>我的博客：<a href="http://blog.lixiaofei.com" target="_blank" rel="noopener">http://blog.lixiaofei.com</a></li>
</ul>
<h3 id="图片">图片</h3>
<p>语法是<code>![图片说明](图片地址 &quot;图片标题&quot;)</code> 注意和链接的区别是前面加了一个!</p>
<p>例如 <img src="https://gitee.com/uploads/20/1580520_alisx.png?1517841484=30%25" alt="图片"></p>
<p>这个感觉很大，能缩小吗？当然能，直接用 html的图片语法好了，例如</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">"https://gitee.com/uploads/20/1580520_alisx.png?1517841484"</span> <span class="attr">width</span>=<span class="string">"25%"</span> <span class="attr">height</span>=<span class="string">"25%"</span>&gt;</span></span></span><br></pre></td></tr></table></figure>
<p>看看效果：</p>
<img src="https://gitee.com/uploads/20/1580520_alisx.png?1517841484" width="25%" height="25%">
<blockquote>
<p>也就是说 Markdown 中可以嵌入 Html 标记**</p>
</blockquote>
<h3 id="音频">音频</h3>
<p>当然也可以插入音频 语法如下</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&#123;% aplayer title author url [picture_url, narrow, autoplay, width:xx%, lrc:xxx] %&#125;</span><br></pre></td></tr></table></figure>
<p>这个不作演示了， 可参考 <a href="https://github.com/MoePlayer/hexo-tag-aplayer/blob/master/docs/README-zh_cn.md" target="_blank" rel="noopener" title="hexo-tag-aplayer 文档">hexo-tag-aplayer</a>,说明得很详细。</p>
<h3 id="转义">转义</h3>
<p>有些时候，我们需要直接显示 Markdown 的标记符合，例如 ** 等，为了避免被解析，在标记前加 <code>\</code> 就可以了。</p>
<p>例如 ** 号， 需要这样写，\**</p>
<p>再如，## 我是个这是不是二级标题 **我也不能加粗**。</p>
<h2 id="引用-强调">引用(强调)</h2>
<p>很多时候，我们需要突出显示一些内容，只要在正常文字前加 <code>&gt;</code> 符合就可以了，例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="quote">&gt; 请注意：这是关于强调部分的演示</span></span><br></pre></td></tr></table></figure>
<p>显示如下：</p>
<blockquote>
<p>请注意：这是关于强调部分的演示</p>
</blockquote>
<p>如果是整段文字，需要在每行前都加 <code>&gt;</code>，空行前也需要加，例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="quote">&gt; 我是引用的内容，值得注意的是不同的markdown解释引擎对相同的语法标记解释是不同的</span></span><br><span class="line">&gt;</span><br><span class="line"><span class="quote">&gt; 和上面的引用是一起的</span></span><br></pre></td></tr></table></figure>
<p>显示如下：</p>
<blockquote>
<p>我是引用的内容，值得注意的是不同的markdown解释引擎对相同的语法标记解释是不同的</p>
<p>和上面的引用是一起的</p>
</blockquote>
<h2 id="列表">列表</h2>
<p>列表分为有序和无序两种。</p>
<p>使用 <code>*</code> 或 <code>+</code> 或 <code>-</code> 来表示无序列表，推荐使用 <code>-</code>,因为只需敲一下，例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="bullet">- </span>要做什么</span><br><span class="line"><span class="bullet">- </span>能怎么做</span><br><span class="line"><span class="bullet">- </span>为什么</span><br><span class="line"><span class="bullet">    - </span>层次</span><br></pre></td></tr></table></figure>
<p>显示为：</p>
<ul>
<li>要做什么</li>
<li>能怎么做</li>
<li>为什么
<ul>
<li>层次</li>
</ul>
</li>
</ul>
<p><code>数字</code>加<code>.</code>来表示有序列表，数字是顺序不重要，但建议按顺序写，以便自己或别人做文稿校对。</p>
<p>例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">1. 个</span><br><span class="line">2. 订单</span><br><span class="line">5. 大</span><br></pre></td></tr></table></figure>
<p>显示为：</p>
<ol>
<li>个</li>
<li>订单</li>
<li>大</li>
</ol>
<p>另外列表可以嵌套，无序有序列表都适用，且可以相互嵌套,</p>
<p>嵌套列表需要比上次列表项缩进<strong>四个空格</strong>，例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="bullet">1. </span>第一大项</span><br><span class="line"><span class="bullet">    1. </span>小项a</span><br><span class="line"><span class="bullet">    2. </span>小项b</span><br><span class="line"><span class="bullet">2. </span>第二大项</span><br><span class="line"><span class="bullet">    - </span>小项c</span><br><span class="line"><span class="bullet">    - </span>小项d</span><br></pre></td></tr></table></figure>
<p>显示为：</p>
<ol>
<li>第一大项
<ol>
<li>小项a</li>
<li>小项b</li>
</ol>
</li>
<li>第二大项
<ul>
<li>小项c</li>
<li>小项d</li>
</ul>
</li>
</ol>
<h2 id="表格">表格</h2>
<p>需要批量展示数据时，使用表格是很好的选择，用 markdown 可以轻松搞定。</p>
<p>用 <code>|</code> 控制分列，用 <code>-</code> 空分行, <code>:</code> 控制对齐方式</p>
<p>具体对齐方式为：</p>
<ul>
<li>左对齐 :----</li>
<li>居中   :—:</li>
<li>右对齐 ----:</li>
</ul>
<p>例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">| Item     | Value     | Qty   |Point|</span><br><span class="line">| :------- | --------: | :---: |--- |</span><br><span class="line">| Computer | 1600 USD  |  5    | 5|</span><br><span class="line">| Phone    | 12 USD    | 12    |6|</span><br><span class="line">| Pipe     | 1 USD     | 234   | &amp;nbsp;|</span><br></pre></td></tr></table></figure>
<p>将显示为：</p>
<table>
<thead>
<tr>
<th style="text-align:left">Item</th>
<th style="text-align:right">Value</th>
<th style="text-align:center">Qty</th>
<th>Point</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Computer</td>
<td style="text-align:right">1600 USD</td>
<td style="text-align:center">5</td>
<td>5</td>
</tr>
<tr>
<td style="text-align:left">Phone</td>
<td style="text-align:right">12 USD</td>
<td style="text-align:center">12</td>
<td>6</td>
</tr>
<tr>
<td style="text-align:left">Pipe</td>
<td style="text-align:right">1 USD</td>
<td style="text-align:center">234</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="代码块">代码块</h2>
<p>有时我们需要展示一下代码，比如这篇文章中的 markdown 代码，需要单独显示，还有就是行内代码，比如 <code>我是个行内代码示例</code>，就需要用到代码块。</p>
<h3 id="行内代码块">行内代码块</h3>
<p>将代码块用 <strong>`</strong> 括起来就行，键盘上在 <code>Esc</code> 按钮下吗，或者在数字 <code>1</code> 左边。</p>
<p><img src="http://blog.lixiaofei.cn/images/2021/09/markdown/01.jpg" alt="`"><br>
另外，行内代码块，Esc可以可以起到<code>强调</code>的作用。</p>
<h3 id="多行代码">多行代码</h3>
<p>只需将代码块包在两行 <strong>```</strong> 直接就可以了。</p>
<p>如何显示语法高亮呢？只需要在第一行 <strong>```</strong> 后面加上对于语言名称就好，例如 Markdown 语法 这样声明： <strong>```markdown</strong>。</p>
<p>javascript 名称为 js, Python 名称为 python 等等。</p>
<p>看看高亮效果：</p>
<p>javascript:</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* Hello world test</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">a</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"Hello world!"</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>python:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># requires_authorization</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">somefunc</span><span class="params">(param1=<span class="string">''</span>, param2=<span class="number">0</span>)</span>:</span></span><br><span class="line">    <span class="string">'''A docstring'''</span></span><br><span class="line">    <span class="keyword">if</span> param1 &gt; param2: <span class="comment"># interesting</span></span><br><span class="line">        <span class="keyword">print</span> <span class="string">'Greater'</span></span><br><span class="line">    <span class="keyword">return</span> (param2 - param1 + <span class="number">1</span>) <span class="keyword">or</span> <span class="literal">None</span></span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">SomeClass</span>:</span></span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line"><span class="meta">&gt;&gt;&gt; </span>message = <span class="string">'''interpreter</span></span><br><span class="line"><span class="string"> prompt'''</span></span><br></pre></td></tr></table></figure>
<h2 id="其他点">其他点</h2>
<h3 id="不隔行换行">不隔行换行</h3>
<p>如果一段文字没有被空行分隔，就会连续显示，即使输入了回车，显示时依旧不换行，如何实现换行呢？</p>
<p>只要在敲回车前再键入两个空格就可以了，例如下面两个例子，</p>
<ul>
<li>
<p><strong>换行前没有加两个空格</strong>：</p>
  <figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">这是第一行，</span><br><span class="line">这是第二行</span><br></pre></td></tr></table></figure>
<p>如何显示呢：</p>
<p>这是第一行，这是第二行</p>
</li>
<li>
<p><strong>换行前加入两个空格</strong></p>
  <figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">这是第一行，  </span><br><span class="line">这是第二行</span><br></pre></td></tr></table></figure>
<p>显示如下：</p>
<p>这是第一行，<br>
这是第二行</p>
</li>
</ul>
<h3 id="缩进">缩进</h3>
<p>对于自媒体文章，一般不需要段落缩进，如果需要的话，需要自己加上特殊的缩进占位符，直接在开头键入空格是没用的</p>
<p>占位符有三种：</p>
<ul>
<li>半角：<code>&amp;ensp;</code> 或者 <code>&amp;#8194;</code>，相当一个英文字符的宽度</li>
<li>全角：<code>&amp;emsp;</code> 或者 <code>&amp;#8195;</code>，相当于一个汉字或者两个英文字符的宽度</li>
<li>空格：<code>&amp;nbsp;</code> 相当于1/4角</li>
</ul>
<p>例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">没有缩进  </span><br><span class="line">&amp;ensp;缩进一个半角  </span><br><span class="line">&amp;emsp;缩进一个全角  </span><br><span class="line">&amp;nbsp;缩进了一个1/4角</span><br><span class="line">&amp;emsp;&amp;emsp;缩进两个全角</span><br></pre></td></tr></table></figure>
<p>没有缩进<br>
 缩进一个半角<br>
 缩进一个全角<br>
 缩进了一个1/4角<br>
  缩进两个全角</p>
<h3 id="不折行">不折行</h3>
<p>一般文字会随屏幕大小折行，如果不想折行，只需要在前面加上四个空格就好了，效果如下：</p>
<pre><code>你想打开一扇门，可到门上有把锁，把锁把门锁住了，“如果能找到钥匙就好了”，你想。可是钥匙在哪里呢？反正不在那把锁上。既然门被锁了，钥匙就一定不会插在锁孔里。
</code></pre>
<h2 id="公众号与-Markdown">公众号与 Markdown</h2>
<p>处于种种原因 公众号网页编辑器截至2021年9月尚不支持 Markdown，不过这个难不倒智慧的人民，有多种办法可以曲线救国。</p>
<p>这里介绍一种我常用的方式，将写好的 Markdown 格式文本，粘贴到 <a href="https://editor.mdnice.com/" target="_blank" rel="noopener" title="墨滴 Markdown">墨滴 https://editor.mdnice.com/</a> 上，就能自动转化为可以直接复制到公众号里的样式了，而且有多种文章分格可选。</p>
<p>可以先在自己喜欢的编辑器里写好，然后做个转化，就可以了。</p>
<h2 id="总结">总结</h2>
<p>Markdown 其实不复杂，只是一些简单的规则，和其他技能一样，只要多加练习，很快就能熟练掌握了。</p>
<p>期望这篇简短教程，能为你的写作之旅提供一点帮助，比心！</p>

    </div>

    
    
    

      <footer class="post-footer">

        

			<div id="wechat_subscriber" style="display: block; padding: 10px 0; margin: 20px auto; width: 100%; text-align: center">
    <img id="wechat_subscriber_qcode" src="/images/wechat-qcode.png" alt="太阳雪 wechat" style="width: 200px; max-width: 100%;"/>
    <div>关注我，获得更多精彩内容</div>
</div>

        
		
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021-08-23-smallstep/" rel="prev" title="这样做了，就真的不一样了">
      <i class="fa fa-chevron-left"></i> 这样做了，就真的不一样了
    </a></div>
      <div class="post-nav-item">
    <a href="/2021-09-06-the-lunch/" rel="next" title="像回家吃饭一样">
      像回家吃饭一样 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#斜体和粗体"><span class="nav-number">1.</span> <span class="nav-text">斜体和粗体</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#标题"><span class="nav-number">2.</span> <span class="nav-text">标题</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#"><span class="nav-number"></span> <span class="nav-text">一级标题</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#"><span class="nav-number"></span> <span class="nav-text">这也是一级标题</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#二级标题"><span class="nav-number">1.</span> <span class="nav-text">二级标题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#这也是二级标题"><span class="nav-number">2.</span> <span class="nav-text">这也是二级标题</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#三级标题"><span class="nav-number">2.1.</span> <span class="nav-text">三级标题</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#这是四级标题"><span class="nav-number">2.1.1.</span> <span class="nav-text">这是四级标题</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#这是五级标题"><span class="nav-number">2.1.1.1.</span> <span class="nav-text">这是五级标题</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#这是六级标题"><span class="nav-number">2.1.1.1.1.</span> <span class="nav-text">这是六级标题</span></a></li></ol></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#分隔线"><span class="nav-number">3.</span> <span class="nav-text">分隔线</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#删除线"><span class="nav-number">4.</span> <span class="nav-text">删除线</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#超链接"><span class="nav-number">5.</span> <span class="nav-text">超链接</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#链接"><span class="nav-number">5.1.</span> <span class="nav-text">链接</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#简易链接"><span class="nav-number">5.2.</span> <span class="nav-text">简易链接</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#图片"><span class="nav-number">5.3.</span> <span class="nav-text">图片</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#音频"><span class="nav-number">5.4.</span> <span class="nav-text">音频</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#转义"><span class="nav-number">5.5.</span> <span class="nav-text">转义</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#引用-强调"><span class="nav-number">6.</span> <span class="nav-text">引用(强调)</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#列表"><span class="nav-number">7.</span> <span class="nav-text">列表</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#表格"><span class="nav-number">8.</span> <span class="nav-text">表格</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#代码块"><span class="nav-number">9.</span> <span class="nav-text">代码块</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#行内代码块"><span class="nav-number">9.1.</span> <span class="nav-text">行内代码块</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#多行代码"><span class="nav-number">9.2.</span> <span class="nav-text">多行代码</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他点"><span class="nav-number">10.</span> <span class="nav-text">其他点</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#不隔行换行"><span class="nav-number">10.1.</span> <span class="nav-text">不隔行换行</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#缩进"><span class="nav-number">10.2.</span> <span class="nav-text">缩进</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#不折行"><span class="nav-number">10.3.</span> <span class="nav-text">不折行</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#公众号与-Markdown"><span class="nav-number">11.</span> <span class="nav-text">公众号与 Markdown</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#总结"><span class="nav-number">12.</span> <span class="nav-text">总结</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="太阳雪"
      src="/images/avatar.png">
  <p class="site-author-name" itemprop="name">太阳雪</p>
  <div class="site-description" itemprop="description">总结 技术 思考 想法</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">88</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">47</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">太阳雪</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  
  <script>
    (function(){
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x=document.getElementsByTagName("link");
		//Find the last canonical URL
		if(x.length > 0){
			for (i=0;i<x.length;i++){
				if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
					canonicalURL=x[i].href;
				}
			}
		}
    //Get protocol
	    if (!canonicalURL){
	    	curProtocol = window.location.protocol.split(':')[0];
	    }
	    else{
	    	curProtocol = canonicalURL.split(':')[0];
	    }
      //Get current URL if the canonical URL does not exist
	    if (!canonicalURL) canonicalURL = window.location.href;
	    //Assign script content. Replace current URL with the canonical URL
      !function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
  </script>















  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'teRj7yeJj0xpfGKLJ5uFdbIu-gzGzoHsz',
      appKey     : '3uie0p1nxouCCnkjiXTEBeLd',
      placeholder: "您的关注是我的动力",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : 'zh-cn' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
